<?php
/**
 * Created by PhpStorm.
 * User: administrator
 * Date: 2016/11/8 
 * Time: 10:12
 */

namespace Common\Api;
 
//设置，获取用户的请求的KEY
class HandleKey { 


	public function encryptedKey($arr=""){

			$key=$arr;
			$key .=$this->getGuid();
            $enkey=strtoupper(md5($key));
			return  $enkey;

	}
	//生成唯一guid
	protected function getGuid(){
		
			$charid = strtoupper(md5(uniqid(mt_rand(), true)));	
			$hyphen = chr(45);// "-"
			$uuid = substr($charid, 0, 8).$hyphen
			.substr($charid, 8, 4).$hyphen
			.substr($charid,12, 4).$hyphen
			.substr($charid,16, 4).$hyphen
			.substr($charid,20,12);
			return $uuid;
      }
		
		
		
		
	}
